package com.heima.article.service.Impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.heima.article.mapper.ApArticleConfigMapper;
import com.heima.article.service.ApArticleConfigService;
import com.heima.model.article.pojos.ApArticleConfig;
import org.springframework.stereotype.Service;

import java.util.HashMap;

@Service
public class ApArticleConfigServiceImpl extends ServiceImpl<ApArticleConfigMapper, ApArticleConfig> implements ApArticleConfigService {
    @Override
    public void updateByMap(HashMap hashMap) {
        Object articleId = hashMap.get("articleId");
        boolean isDown = true;
        if (hashMap.get("enable").equals(1)) {
            isDown = false;
        }
        update(null, Wrappers.<ApArticleConfig>lambdaUpdate().eq(ApArticleConfig::getArticleId, articleId).set(ApArticleConfig::getIsDown, isDown));
    }
}
